<?php
/**
 * Tlacitko
 * @author Tomas Srna
 * @package bakalarka
 */
class Button
{
	public $img, $title, $fn;
	
	public $params;
	
	public function __construct($img, $title, $fn)
	{
		$this->img = $img;
		$this->title = $title;
		$this->fn = $fn;
	}
	
	public function setParams($params)
	{
		$this->params = $params;
	}
	
	public function __toString()
	{
		$appbase = APPBASE;
		$fn = str_replace('%params%', $this->params, $this->fn);
		
		return <<<EOT
<button onclick="$fn">
	<img src="{$appbase}img/{$this->img}" alt="" />
	$this->title
</button>
EOT;
	}
}
